import {isArray} from "./isArray";
import {isString} from "@ng-bootstrap/ng-bootstrap/util/util";
import {isNumber} from "./isNumber";

/**
 * 转换为数组
 */
function toArray(val, split) {
  if (isArray(val)) {
    return val.filter(function (val) {
      return !!val;
    });
  } else if (isString(val)) {
    return val.split(split || ",").filter(function (val) {
      return !!val;
    });
  } else if (isNumber(val)) {
    return [val + ""];
  } else {
    return [];
  }
}
export {toArray}
